package com.shunde.xunjian.controller;

import com.shunde.xunjian.service.impl.FileServiceImpl;
import com.shunde.xunjian.util.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;


@RestController
@RequestMapping("/File")
public class FileController {
    @Autowired
    private FileServiceImpl fileService;

    //上传文件
    @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
    public Object uploadFile(@RequestPart(value = "file") MultipartFile file, String tableName, String fieldName) throws IOException {
        return Results.success(fileService.uploadFile(file,tableName,fieldName)) ;
    }

}
